<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>echarts</title>
    <style>
      .container {
        width: 800px;
        height: 400px;
      }
    </style>
  </head>
  <body>
    <div class="container"></div>
    <script src="https://cdn.jsdelivr.net/npm/echarts@5.4.0/dist/echarts.min.js"></script>
    <script>
      const myEcharts = echarts.init(document.querySelector(".container"));
      const option = {
        xAxis: {
          data: [
            "一月",
            "二月",
            "三月",
            "四月",
            "五月",
            "六月",
            "七月",
            "八月",
            "九月",
            "十月",
            "十一月",
            "十二月",
          ],
        },
        yAxis: {},
        tooltip: {},
        // 图例：显示隐藏图表
        legend: {
          data: ["柱形图", "折线图", "饼图"],
        },
        series: [
          {
            name: "柱形图",
            type: "bar",
            data: [15, 25, 36, 30, 24, 15, 25, 36, 30, 24, 44, 23],
          },
          {
            name: "折线图",
            type: "line",
            data: [25, 15, 46, 20, 14, 35, 15, 46, 20, 34, 34, 13],
          },
          {
            name: "饼图",
            type: "pie",
            data: [
              { name: "xx", value: 11 },
              { name: "yy", value: 22 },
              { name: "zz", value: 33 },
            ],
            // 半径
            radius: [0, 30],
            // 圆心点坐标
            center: [650, 40],
          },
        ],
      };
      myEcharts.setOption(option);
    </script>
  </body>
</html>
